package com.gopay.webtest.handler;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.gopay.webtest.util.BaseSign;
import com.gopay.webtest.util.ReflectUtil;

/**
 * 网关付款到银行签名类
 * 
 * @Trans00700SignHandler.java
 * @author fanghw
 * @2013-11-8 下午2:25:07 www.gopay.com.cn Inc.All rights reserved.
 */
@Repository("trans00700SignHandler")
public class Trans00700SignHandler extends BaseSign {
    @Override
    public String execute(Object obj, List<String> signFields) throws Exception {

        if (signFields == null || signFields.size() == 0)
            throw new Exception("组装加签明文失败，加签域");
        StringBuffer sb = new StringBuffer();
        String value;
        for (String singField : signFields) {
            if ("verficationCode".equals(singField)) {
                sb.append("VerficationCode");
            } else {
                sb.append(singField);
            }

            sb.append("=[");
            
            value=ReflectUtil.getFieldValue(obj, singField);
            
            sb.append(value==null?"":value);

            sb.append("]");
        }
        return sb.toString();
    }
}
